import { MediaStatus } from "@/common/const";
import type { Station } from "../types/interface";

export default abstract class BaseAudioPlayer {
    protected status: MediaStatus = MediaStatus.stoped;
    public onStatusChange: ((status: MediaStatus) => void) | null = null;

    abstract play(radio: Station): void;
    abstract pause(): void;
    abstract stop(): void;

    protected setStatus(status: MediaStatus) {
        this.status = status;
        this.onStatusChange?.(status);
    }

    getStatus(): MediaStatus {
        return this.status;
    }
}
